package org.jeecg.modules.driver;

import org.codehaus.jettison.json.JSONObject;
import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient;
import org.jeecg.modules.commu.ClientConnection;
import org.jeecg.modules.device.Device;

public abstract class DeviceDriver {

    protected Device device;
    protected ClientConnection connection;
    protected RabbitMqClient client;

    public DeviceDriver(Device device, ClientConnection connection, RabbitMqClient client){
        this.connection = connection;
        this.device = device;
        this.client = client;
    }
    public abstract boolean runCommand(String command, JSONObject data) ;

    public abstract Device resolveCommand(String d_cmd, String msg);

    public Device getDevice() {
        return device;
    }

    public void setDevice(Device device) {
        this.device = device;
    }

    public ClientConnection getConnection() {
        return connection;
    }

    public void setConnection(ClientConnection connection) {
        this.connection = connection;
    }

    public void registerMq(RabbitMqClient rabbitMqClient){
        this.client = rabbitMqClient;
    }
}
